package com.foxit.pdf2html5.common.utils;

import java.io.File;

/**
 * @author shaojie_zhuo
 * @version 1.0
 * Path utils.
 */
public class FXPathUtils {
	/**
	 * Create an new directory.
	 * @param strFullPath directory to create.
	 * @param isPathWithFileName whether the path include file name.
	 * @return return true if create the directory successfully, otherwise return false.
	 */
	public static boolean createDirectory(String strFullPath, boolean isPathWithFileName)
    {
        if (isPathWithFileName)
        {
            int nIndex = strFullPath.lastIndexOf('\\');
            if(nIndex == -1)
                nIndex = strFullPath.lastIndexOf('/');
            if(nIndex != -1)
              strFullPath = strFullPath.substring(0, nIndex);
        }
        File dir = new File(strFullPath);
        if (!dir.exists()) {
			dir.mkdirs();
		}
        return dir.exists();
    }
}
